<?php
require 'MaxHeap.php';

$maxHeap = new MaxHeap();
$maxHeap->add(['key' => "A", 'value' => 10]);
$maxHeap->add(['key' => "B", 'value' => 7]);
$maxHeap->add(['key' => "C", 'value' => 5]);
$maxHeap->add(['key' => "D", 'value' => 4]);


for ($i = 0; $i < 120; $i++) {
    $max  = $maxHeap->getMax(); //取出堆顶元素
    $size = $maxHeap->getSize();
    for ($j = 0; $j < $size; $j++) {
        $maxHeap->increment($j);
    }
    $max['value'] = $max['value'] - 3;
    $maxHeap->add($max);
    print_r($i);
}

print_r($maxHeap);
